package com.blue.base.common.exception;

/**
 * 基础错误异常
 *
 * @author liulei
 * @version 1.0
 */
public class BaseException extends RuntimeException {

    public static final int SERVICE_UNKNOWN_ERROR = 500;
    public static final int NOT_AUTHORIZED = 600;
    public static final int SERVICE_OVER_LOAD = 700;
    public static final int PARAM_MISSED = 800;
    public static final int DATA_ALREADY_EXIST = 850;
    public static final int METHOD_NOT_SUPPORT = 900;

    /**
     * 错误码
     */
    private int code;
    /**
     * 错误信息
     */
    private String errorMessage;

    public BaseException(int code) {
        super("error code " + code);
        this.code = code;
    }

    public BaseException(int code, String errorMessage) {
        super(errorMessage);
        this.code = code;
        this.errorMessage = errorMessage;
    }

    public int getCode() {
        return code;
    }


    public String getErrorMessage() {
        return errorMessage;
    }
}
